package com.woniu.service.impl;

import com.woniu.entity.WaitPutaway;
import com.woniu.mapper.WaitPutawayMapper;
import com.woniu.service.WaitPutawayService;
import com.woniu.utils.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class WaitPutawayServiceImpl implements WaitPutawayService {
    SqlSession sqlSession = MyBatisUtil.getSqlSession();
    WaitPutawayMapper mapper = sqlSession.getMapper(WaitPutawayMapper.class);
    @Override
    public void insertWaitPutaway(WaitPutaway waitPutaway) {
        mapper.insertWaitPutaway(waitPutaway);
        sqlSession.commit();
        sqlSession.close();
    }

    @Override
    public List<WaitPutaway> selectWaitPutaway() {
        List<WaitPutaway> waitPutawayList = mapper.selectWaitPutaway();
        return waitPutawayList;
    }

    @Override
    public void deleteWaitPutaway(int wid) {
        mapper.deleteWaitPutaway(wid);
        sqlSession.commit();
        sqlSession.close();
    }

    @Override
    public WaitPutaway selectWaitPutawayByWid(int wid) {
         WaitPutaway waitPutaway = mapper.selectWaitPutawayByWid(wid);
        return waitPutaway;
    }
}
